package com.hank.snakegame;

import lombok.Getter;
import lombok.Setter;

import java.awt.*;

@Getter
@Setter
public class Cell {
    private int x;
    private int y;
    private Color color;

    public Cell(int x, int y, Color color) {
        this.x = x;
        this.y = y;
        this.color = color;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof  Cell){
            Cell anotherCell = (Cell)obj;
            return this.x == anotherCell.x  && this.y == anotherCell.y;
        }
        return super.equals(obj);
    }

    public void paint(Graphics g){
        g.setColor(this.color);
        g.fill3DRect(x * GamePanel.CELL_UNIT,y*GamePanel.CELL_UNIT,GamePanel.CELL_UNIT,GamePanel.CELL_UNIT,true);
    }
}
